//
//  MyMapView.m
//  FoodCorner
//
//  Created by apple on 16/3/5.
//  Copyright © 2016年 zhangchao. All rights reserved.
//

#import "MyMapView.h"

@implementation MyMapView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self == [super initWithFrame:frame]) {
        [self addAllViews];
    }
    return self;
}

- (void)addAllViews
{
    self.startLocationBtn = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.startLocationBtn setTitle:@"定位" forState:(UIControlStateNormal)];
    self.startLocationBtn.backgroundColor = [UIColor blueColor];
    [self.startLocationBtn setTintColor:[UIColor yellowColor]];
    self.startLocationBtn.frame = CGRectMake(10, 70, self.frame.size.width*0.2, 30);
    
    self.inputTargetTF = [[UITextField alloc] init];
    self.inputTargetTF.backgroundColor = [UIColor lightGrayColor];
    self.inputTargetTF.tintColor = [UIColor blackColor];
    self.inputTargetTF.placeholder = @"请输入搜索项";
    self.inputTargetTF.frame = CGRectMake(self.startLocationBtn.frame.size.width+15, 70, self.frame.size.width*0.35, 30);
    
    self.startSearchBtn = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.startSearchBtn setTitle:@"搜索" forState:(UIControlStateNormal)];
    self.startSearchBtn.backgroundColor = [UIColor blueColor];
    [self.startSearchBtn setTintColor:[UIColor yellowColor]];
    self.startSearchBtn.frame = CGRectMake(self.inputTargetTF.frame.origin.x+self.inputTargetTF.frame.size.width+5, 70, self.startLocationBtn.frame.size.width, 30);
    
    self.nextPageBtn = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.nextPageBtn setTitle:@"更多" forState:(UIControlStateNormal)];
    self.nextPageBtn.backgroundColor = [UIColor blueColor];
    [self.nextPageBtn setTintColor:[UIColor yellowColor]];
    self.nextPageBtn.frame = CGRectMake(self.startSearchBtn.frame.origin.x+self.startSearchBtn.frame.size.width+5, 70, self.startLocationBtn.frame.size.width, 30);
    
    [self addSubview:self.inputTargetTF];
    [self addSubview:self.startLocationBtn];
    [self addSubview:self.startSearchBtn];
    [self addSubview:self.nextPageBtn];
}

//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//    self.inputTargetTF.frame = CGRectMake(10, 50, 100, 30);
//}

@end
